<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AWTK-JAVA: awtk.ComboBox类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AWTK-JAVA
   </div>
   <div id="projectbrief">AWTK JAVA API</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>awtk</b></li><li class="navelem"><a class="el" href="classawtk_1_1_combo_box.html">ComboBox</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-static-methods">静态 Public 成员函数</a> &#124;
<a href="#pub-attribs">Public 属性</a> &#124;
<a href="classawtk_1_1_combo_box-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">awtk.ComboBox类 参考</div>  </div>
</div><!--header-->
<div class="contents">
<div class="dynheader">
类 awtk.ComboBox 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classawtk_1_1_combo_box.png" usemap="#awtk.ComboBox_map" alt=""/>
  <map id="awtk.ComboBox_map" name="awtk.ComboBox_map">
<area href="classawtk_1_1_combo_box_ex.html" alt="awtk.ComboBoxEx" shape="rect" coords="0,112,115,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a5fae7c78e1a41f2a9bc8e405d4742d3d"><td class="memItemLeft" align="right" valign="top"><a id="a5fae7c78e1a41f2a9bc8e405d4742d3d"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>ComboBox</b> (long nativeObj)</td></tr>
<tr class="separator:a5fae7c78e1a41f2a9bc8e405d4742d3d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a185bd6bd6c2ea5b1f4fd9e8fa32d2fec"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a185bd6bd6c2ea5b1f4fd9e8fa32d2fec">setOpenWindow</a> (String open_window)</td></tr>
<tr class="separator:a185bd6bd6c2ea5b1f4fd9e8fa32d2fec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac6e833c311ae42611a36470c84b6aaf3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#ac6e833c311ae42611a36470c84b6aaf3">resetOptions</a> ()</td></tr>
<tr class="separator:ac6e833c311ae42611a36470c84b6aaf3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa93c04311d4b34e090d2c07a725cf4af"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#aa93c04311d4b34e090d2c07a725cf4af">countOptions</a> ()</td></tr>
<tr class="separator:aa93c04311d4b34e090d2c07a725cf4af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a93450999af1b7722372e0da3d1c5b687"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a93450999af1b7722372e0da3d1c5b687">setSelectedIndex</a> (int index)</td></tr>
<tr class="separator:a93450999af1b7722372e0da3d1c5b687"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8585844ca86c690f6a2fdb7d00f22de7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a8585844ca86c690f6a2fdb7d00f22de7">setLocalizeOptions</a> (boolean localize_options)</td></tr>
<tr class="separator:a8585844ca86c690f6a2fdb7d00f22de7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a87157329ff781c1a08f2438d485bb063"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a87157329ff781c1a08f2438d485bb063">setValue</a> (int value)</td></tr>
<tr class="separator:a87157329ff781c1a08f2438d485bb063"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a42da0eadda777eecd64db2298cdd394c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a42da0eadda777eecd64db2298cdd394c">setItemHeight</a> (int item_height)</td></tr>
<tr class="separator:a42da0eadda777eecd64db2298cdd394c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab556f66ffa28cde6e6dfd05116354e6c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#ab556f66ffa28cde6e6dfd05116354e6c">appendOption</a> (int value, String text)</td></tr>
<tr class="separator:ab556f66ffa28cde6e6dfd05116354e6c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6e82cb6272c1048d42d4407545280b0c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a6e82cb6272c1048d42d4407545280b0c">setOptions</a> (String options)</td></tr>
<tr class="separator:a6e82cb6272c1048d42d4407545280b0c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abe6274015434ac47344f38c85ac6bd40"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#abe6274015434ac47344f38c85ac6bd40">getValue</a> ()</td></tr>
<tr class="separator:abe6274015434ac47344f38c85ac6bd40"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adb3a1722fb521bc220d544cee5169977"><td class="memItemLeft" align="right" valign="top">String&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#adb3a1722fb521bc220d544cee5169977">getTextValue</a> ()</td></tr>
<tr class="separator:adb3a1722fb521bc220d544cee5169977"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adda687577724f7604b8408b196e5b7e8"><td class="memItemLeft" align="right" valign="top">String&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#adda687577724f7604b8408b196e5b7e8">getOpenWindow</a> ()</td></tr>
<tr class="separator:adda687577724f7604b8408b196e5b7e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f689cb05c73b5627a04e46b126e4c29"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a0f689cb05c73b5627a04e46b126e4c29">getSelectedIndex</a> ()</td></tr>
<tr class="separator:a0f689cb05c73b5627a04e46b126e4c29"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4161724430b78976eb5fa46b151e3b3d"><td class="memItemLeft" align="right" valign="top">boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a4161724430b78976eb5fa46b151e3b3d">getLocalizeOptions</a> ()</td></tr>
<tr class="separator:a4161724430b78976eb5fa46b151e3b3d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a43384bf1536631b96904a303aa1cf13a"><td class="memItemLeft" align="right" valign="top">String&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a43384bf1536631b96904a303aa1cf13a">getOptions</a> ()</td></tr>
<tr class="separator:a43384bf1536631b96904a303aa1cf13a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:addbfadca5b57febae2edf0ed01d928cd"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#addbfadca5b57febae2edf0ed01d928cd">getItemHeight</a> ()</td></tr>
<tr class="separator:addbfadca5b57febae2edf0ed01d928cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
静态 Public 成员函数</h2></td></tr>
<tr class="memitem:a64ae9aa964fcbadb72d57e619f4d3bc2"><td class="memItemLeft" align="right" valign="top"><a id="a64ae9aa964fcbadb72d57e619f4d3bc2"></a>
static <a class="el" href="classawtk_1_1_combo_box.html">ComboBox</a>&#160;</td><td class="memItemRight" valign="bottom"><b>cast</b> (long nativeObj)</td></tr>
<tr class="separator:a64ae9aa964fcbadb72d57e619f4d3bc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac2d5e06e09a5b4a3babbba6438688249"><td class="memItemLeft" align="right" valign="top">static Widget&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#ac2d5e06e09a5b4a3babbba6438688249">create</a> (Widget parent, int x, int y, int w, int h)</td></tr>
<tr class="separator:ac2d5e06e09a5b4a3babbba6438688249"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26b8bdaaf4996ef9301dbbd9fa82882d"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classawtk_1_1_combo_box.html">ComboBox</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_combo_box.html#a26b8bdaaf4996ef9301dbbd9fa82882d">cast</a> (Widget widget)</td></tr>
<tr class="separator:a26b8bdaaf4996ef9301dbbd9fa82882d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public 属性</h2></td></tr>
<tr class="memitem:a9402eed805d494ef87e24b822b355abb"><td class="memItemLeft" align="right" valign="top"><a id="a9402eed805d494ef87e24b822b355abb"></a>
long&#160;</td><td class="memItemRight" valign="bottom"><b>nativeObj</b></td></tr>
<tr class="separator:a9402eed805d494ef87e24b822b355abb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>下拉列表控件。</p>
<p>点击右边的按钮，可弹出一个下拉列表，从中选择一项作为当前的值。</p>
<p>combo_box_t是edit的子类控件，edit_t的函数均适用于combo_box_t控件。</p>
<p>在xml中使用"combo_box"标签创建下拉列表控件。</p>
<p>列表选项可以直接写在"options"属性中。如：</p>
<div class="fragment"><div class="line">&lt;<span class="keywordtype">combo_box</span> <span class="keyword">readonly</span>=<span class="stringliteral">&quot;true&quot;</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;10&quot;</span> <span class="keyword">y</span>=<span class="stringliteral">&quot;bottom:5&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;200&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;30&quot;</span> <span class="keyword">tr_text</span>=<span class="stringliteral">&quot;ok&quot;</span></div><div class="line"><span class="keyword">options</span>=<span class="stringliteral">&quot;1:ok;2:cancel;&quot;</span>/&gt;</div></div><!-- fragment --><p>列表选项也可以放在独立的窗口中，用属性"open_window"指定窗口的名称。如：</p>
<div class="fragment"><div class="line">&lt;<span class="keywordtype">combo_box</span> <span class="keyword">open_window</span>=<span class="stringliteral">&quot;language&quot;</span> <span class="keyword">readonly</span>=<span class="stringliteral">&quot;true&quot;</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;10&quot;</span> <span class="keyword">y</span>=<span class="stringliteral">&quot;bottom:50&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;200&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;30&quot;</span></div><div class="line"><span class="keyword">tr_text</span>=<span class="stringliteral">&quot;english&quot;</span>/&gt;</div></div><!-- fragment --><p>language.xml:</p>
<div class="fragment"><div class="line">&lt;<span class="keywordtype">popup</span> <span class="keyword">close_when_click_outside</span>=<span class="stringliteral">&quot;true&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;80&quot;</span></div><div class="line">&lt;<span class="keywordtype">list_view</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;0&quot;</span>  <span class="keyword">y</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;100%&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;100%&quot;</span> <span class="keyword">item_height</span>=<span class="stringliteral">&quot;30&quot;</span>&gt;</div><div class="line">&lt;<span class="keywordtype">scroll_view</span> <span class="keyword">name</span>=<span class="stringliteral">&quot;view&quot;</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;0&quot;</span>  <span class="keyword">y</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;-12&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;100%&quot;</span>&gt;</div><div class="line">&lt;<span class="keywordtype">combo_box_item</span> <span class="keyword">tr_text</span>=<span class="stringliteral">&quot;english&quot;</span>/&gt;</div><div class="line">&lt;<span class="keywordtype">combo_box_item</span> <span class="keyword">tr_text</span>=<span class="stringliteral">&quot;chinese&quot;</span> /&gt;</div><div class="line">&lt;/<span class="keywordtype">scroll_view</span>&gt;</div><div class="line">&lt;<span class="keywordtype">scroll_bar_d</span> <span class="keyword">name</span>=<span class="stringliteral">&quot;bar&quot;</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;right&quot;</span> <span class="keyword">y</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;12&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;100%&quot;</span> <span class="keyword">value</span>=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div><div class="line">&lt;/<span class="keywordtype">list_view</span>&gt;</div><div class="line">&lt;/<span class="keywordtype">popup</span>&gt;</div></div><!-- fragment --><p>更多用法请参考：<a href="https://github.com/zlgopen/awtk/blob/master/demos/assets/default/raw/ui/combo_box.xml">combo_box.xml</a></p>
<p>如果在文本比较长时，希望在获得焦点时文本自动滚动，可以放入一个hscroll_label为子控件，并命名为"value"。如：</p>
<div class="fragment"><div class="line">&lt;<span class="keywordtype">combo_box</span> <span class="keyword">left_margin</span>=<span class="stringliteral">&quot;6&quot;</span> <span class="keyword">readonly</span>=<span class="stringliteral">&quot;true&quot;</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;10&quot;</span> <span class="keyword">y</span>=<span class="stringliteral">&quot;50&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;80&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;30&quot;</span> <span class="keyword">options</span>=<span class="stringliteral">&quot;leftttttttttt;centerrrrrrrrrrrrrrrr;rightttttttttt;&quot;</span></div><div class="line"><span class="keyword">selected_index</span>=<span class="stringliteral">&quot;1&quot;</span>&gt;</div><div class="line">&lt;<span class="keywordtype">hscroll_label</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">y</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;-30&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;100%&quot;</span></div><div class="line"><span class="keyword">name</span>=<span class="stringliteral">&quot;value&quot;</span></div><div class="line"><span class="keyword">lull</span>=<span class="stringliteral">&quot;1000&quot;</span></div><div class="line"><span class="keyword">loop</span>=<span class="stringliteral">&quot;true&quot;</span></div><div class="line"><span class="keyword">yoyo</span>=<span class="stringliteral">&quot;true&quot;</span></div><div class="line"><span class="keyword">ellipses</span>=<span class="stringliteral">&quot;true&quot;</span></div><div class="line"><span class="keyword">only_parent_focus</span>=<span class="stringliteral">&quot;true&quot;</span>/&gt;</div><div class="line">&lt;<span class="keywordtype">button</span> <span class="keyword">style</span>=<span class="stringliteral">&quot;combobox_down&quot;</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;right:5&quot;</span> <span class="keyword">y</span>=<span class="stringliteral">&quot;middle&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;20&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;20&quot;</span>/&gt;</div><div class="line">&lt;/<span class="keywordtype">combo_box</span>&gt;</div></div><!-- fragment --><p>在c代码中使用函数combo_box_create创建下拉列表控件。如：</p>
<p>创建之后：</p>
<ul>
<li>用combo_box_set_options设置可选项目。</li>
<li>用combo_box_set_selected_index设置缺省项。</li>
</ul>
<p>完整示例请参考：<a href="https://github.com/zlgopen/awtk-c-demos/blob/master/demos/combo_box.c">combo_box demo</a></p>
<p>可用通过style来设置控件的显示风格，如字体的大小和颜色等等。如：</p>
<div class="fragment"><div class="line">&lt;<span class="keywordtype">combo_box</span>&gt;</div><div class="line">&lt;<span class="keywordtype">style</span> <span class="keyword">name</span>=<span class="stringliteral">&quot;default&quot;</span> <span class="keyword">border_color</span>=<span class="stringliteral">&quot;#a0a0a0&quot;</span>  <span class="keyword">text_color</span>=<span class="stringliteral">&quot;black&quot;</span> <span class="keyword">text_align_h</span>=<span class="stringliteral">&quot;left&quot;</span>&gt;</div><div class="line">&lt;<span class="keywordtype">normal</span>     <span class="keyword">bg_color</span>=<span class="stringliteral">&quot;#f0f0f0&quot;</span> /&gt;</div><div class="line">&lt;<span class="keywordtype">focused</span>    <span class="keyword">bg_color</span>=<span class="stringliteral">&quot;#f0f0f0&quot;</span> <span class="keyword">border_color</span>=<span class="stringliteral">&quot;black&quot;</span>/&gt;</div><div class="line">&lt;<span class="keywordtype">empty</span>      <span class="keyword">bg_color</span>=<span class="stringliteral">&quot;#f0f0f0&quot;</span> <span class="keyword">text_color</span>=<span class="stringliteral">&quot;#a0a0a0&quot;</span> /&gt;</div><div class="line">&lt;/<span class="keywordtype">style</span>&gt;</div><div class="line">&lt;/<span class="keywordtype">combo_box</span>&gt;</div></div><!-- fragment --><ul>
<li>1.combobox的下拉按钮的style名称为combobox_down，可以在主题文件中设置。</li>
</ul>
<div class="fragment"><div class="line">&lt;<span class="keywordtype">button</span>&gt;</div><div class="line">&lt;<span class="keywordtype">style</span> <span class="keyword">name</span>=<span class="stringliteral">&quot;combobox_down&quot;</span> <span class="keyword">border_color</span>=<span class="stringliteral">&quot;#a0a0a0&quot;</span>&gt;</div><div class="line">&lt;<span class="keywordtype">normal</span>     <span class="keyword">bg_color</span>=<span class="stringliteral">&quot;#f0f0f0&quot;</span> <span class="keyword">icon</span>=<span class="stringliteral">&quot;arrow_down_n&quot;</span>/&gt;</div><div class="line">&lt;<span class="keywordtype">pressed</span>    <span class="keyword">bg_color</span>=<span class="stringliteral">&quot;#c0c0c0&quot;</span> <span class="keyword">icon</span>=<span class="stringliteral">&quot;arrow_down_p&quot;</span>/&gt;</div><div class="line">&lt;<span class="keywordtype">over</span>       <span class="keyword">bg_color</span>=<span class="stringliteral">&quot;#e0e0e0&quot;</span> <span class="keyword">icon</span>=<span class="stringliteral">&quot;arrow_down_o&quot;</span>/&gt;</div><div class="line">&lt;/<span class="keywordtype">style</span>&gt;</div><div class="line">&lt;/<span class="keywordtype">button</span>&gt;</div></div><!-- fragment --><ul>
<li>2.combobox的弹出popup窗口的style名称为combobox_popup，可以在主题文件中设置。</li>
</ul>
<div class="fragment"><div class="line">&lt;<span class="keywordtype">popup</span>&gt;</div><div class="line">&lt;<span class="keywordtype">style</span> <span class="keyword">name</span>=<span class="stringliteral">&quot;combobox_popup&quot;</span> <span class="keyword">border_color</span>=<span class="stringliteral">&quot;red&quot;</span>&gt;</div><div class="line">&lt;<span class="keywordtype">normal</span> <span class="keyword">bg_color</span>=<span class="stringliteral">&quot;#808080&quot;</span>/&gt;</div><div class="line">&lt;/<span class="keywordtype">style</span>&gt;</div><div class="line">&lt;/<span class="keywordtype">popup</span>&gt;</div></div><!-- fragment --><p>更多用法请参考：<a href="https://github.com/zlgopen/awtk/blob/master/demos/assets/default/raw/styles/default.xml#L422">theme default</a> </p>
</div><h2 class="groupheader">成员函数说明</h2>
<a id="ab556f66ffa28cde6e6dfd05116354e6c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab556f66ffa28cde6e6dfd05116354e6c">&#9670;&nbsp;</a></span>appendOption()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.ComboBox.appendOption </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">String&#160;</td>
          <td class="paramname"><em>text</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>追加一个选项。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>值。 </td></tr>
    <tr><td class="paramname">text</td><td>文本。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<a id="a26b8bdaaf4996ef9301dbbd9fa82882d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a26b8bdaaf4996ef9301dbbd9fa82882d">&#9670;&nbsp;</a></span>cast()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classawtk_1_1_combo_box.html">ComboBox</a> awtk.ComboBox.cast </td>
          <td>(</td>
          <td class="paramtype">Widget&#160;</td>
          <td class="paramname"><em>widget</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>转换combo_box对象(供脚本语言使用)。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">widget</td><td>combo_box对象。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>combo_box对象。 </dd></dl>

</div>
</div>
<a id="aa93c04311d4b34e090d2c07a725cf4af"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa93c04311d4b34e090d2c07a725cf4af">&#9670;&nbsp;</a></span>countOptions()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int awtk.ComboBox.countOptions </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>获取选项个数。</p>
<dl class="section return"><dt>返回</dt><dd>返回选项个数。 </dd></dl>

</div>
</div>
<a id="ac2d5e06e09a5b4a3babbba6438688249"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac2d5e06e09a5b4a3babbba6438688249">&#9670;&nbsp;</a></span>create()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static Widget awtk.ComboBox.create </td>
          <td>(</td>
          <td class="paramtype">Widget&#160;</td>
          <td class="paramname"><em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>w</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>h</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>创建combo_box对象</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">parent</td><td>父控件 </td></tr>
    <tr><td class="paramname">x</td><td>x坐标 </td></tr>
    <tr><td class="paramname">y</td><td>y坐标 </td></tr>
    <tr><td class="paramname">w</td><td>宽度 </td></tr>
    <tr><td class="paramname">h</td><td>高度</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>对象。 </dd></dl>

</div>
</div>
<a id="addbfadca5b57febae2edf0ed01d928cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#addbfadca5b57febae2edf0ed01d928cd">&#9670;&nbsp;</a></span>getItemHeight()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int awtk.ComboBox.getItemHeight </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>下拉选项的高度。如果open_window为空，则使用缺省高度。 </p>

</div>
</div>
<a id="a4161724430b78976eb5fa46b151e3b3d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4161724430b78976eb5fa46b151e3b3d">&#9670;&nbsp;</a></span>getLocalizeOptions()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">boolean awtk.ComboBox.getLocalizeOptions </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>是否本地化(翻译)选项(缺省为TRUE)。 </p>

</div>
</div>
<a id="adda687577724f7604b8408b196e5b7e8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adda687577724f7604b8408b196e5b7e8">&#9670;&nbsp;</a></span>getOpenWindow()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">String awtk.ComboBox.getOpenWindow </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>为点击按钮时，要打开窗口的名称。 </p>

</div>
</div>
<a id="a43384bf1536631b96904a303aa1cf13a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a43384bf1536631b96904a303aa1cf13a">&#9670;&nbsp;</a></span>getOptions()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">String awtk.ComboBox.getOptions </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>设置可选项(冒号分隔值和文本，分号分隔选项，如:1:red;2:green;3:blue)。 </p>

</div>
</div>
<a id="a0f689cb05c73b5627a04e46b126e4c29"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0f689cb05c73b5627a04e46b126e4c29">&#9670;&nbsp;</a></span>getSelectedIndex()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int awtk.ComboBox.getSelectedIndex </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>当前选中的选项。 </p>

</div>
</div>
<a id="adb3a1722fb521bc220d544cee5169977"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adb3a1722fb521bc220d544cee5169977">&#9670;&nbsp;</a></span>getTextValue()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">String awtk.ComboBox.getTextValue </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>获取combo_box的文本。</p>
<dl class="section return"><dt>返回</dt><dd>返回文本。 </dd></dl>

</div>
</div>
<a id="abe6274015434ac47344f38c85ac6bd40"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abe6274015434ac47344f38c85ac6bd40">&#9670;&nbsp;</a></span>getValue()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int awtk.ComboBox.getValue </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>获取combo_box的值。</p>
<dl class="section return"><dt>返回</dt><dd>返回值。 </dd></dl>

</div>
</div>
<a id="ac6e833c311ae42611a36470c84b6aaf3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac6e833c311ae42611a36470c84b6aaf3">&#9670;&nbsp;</a></span>resetOptions()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.ComboBox.resetOptions </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>重置所有选项。</p>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<a id="a42da0eadda777eecd64db2298cdd394c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a42da0eadda777eecd64db2298cdd394c">&#9670;&nbsp;</a></span>setItemHeight()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.ComboBox.setItemHeight </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>item_height</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>设置item高度。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">item_height</td><td>item的高度。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<a id="a8585844ca86c690f6a2fdb7d00f22de7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8585844ca86c690f6a2fdb7d00f22de7">&#9670;&nbsp;</a></span>setLocalizeOptions()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.ComboBox.setLocalizeOptions </td>
          <td>(</td>
          <td class="paramtype">boolean&#160;</td>
          <td class="paramname"><em>localize_options</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>设置是否本地化(翻译)选项。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">localize_options</td><td>是否本地化(翻译)选项。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<a id="a185bd6bd6c2ea5b1f4fd9e8fa32d2fec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a185bd6bd6c2ea5b1f4fd9e8fa32d2fec">&#9670;&nbsp;</a></span>setOpenWindow()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.ComboBox.setOpenWindow </td>
          <td>(</td>
          <td class="paramtype">String&#160;</td>
          <td class="paramname"><em>open_window</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>点击按钮时可以打开popup窗口，本函数可设置窗口的名称。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">open_window</td><td>弹出窗口的名称。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<a id="a6e82cb6272c1048d42d4407545280b0c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6e82cb6272c1048d42d4407545280b0c">&#9670;&nbsp;</a></span>setOptions()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.ComboBox.setOptions </td>
          <td>(</td>
          <td class="paramtype">String&#160;</td>
          <td class="paramname"><em>options</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>设置选项。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">options</td><td>选项。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<a id="a93450999af1b7722372e0da3d1c5b687"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a93450999af1b7722372e0da3d1c5b687">&#9670;&nbsp;</a></span>setSelectedIndex()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.ComboBox.setSelectedIndex </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>index</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>设置第index个选项为当前选中的选项。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">index</td><td>选项的索引。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<a id="a87157329ff781c1a08f2438d485bb063"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a87157329ff781c1a08f2438d485bb063">&#9670;&nbsp;</a></span>setValue()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.ComboBox.setValue </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>设置值。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>值。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>output/ComboBox.java</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
